package java_oop.demo05;

/**
 * @author IT_Jay
 * @date 2022/1/24 19:37
 */

public class Student extends Person{
    public Student() {
        //隐藏代码：调用了父类的无参构造
        //super();   //调用父类的构造器，必须在子类构造器的第一行
//        this("111");        //调用自己的构造器也要写在第一行，故不能和super同时使用
        System.out.println("Student无参构造执行");
    }

    //有参构造


    public Student(String name) {
        this.name = name;
    }

    private String name = "六爷";

    public void print(){
        System.out.println("Student");
    }

    public void test(String name){
        System.out.println(name);
        System.out.println(this.name);
        System.out.println(super.name);
    }

    public void test01(){
        print();
        this.print();
        super.print();
    }
}


/**
 * public static void main(String[] args) {
 *         Student student = new Student();
 *         student.test("张牧之");
 *         System.out.println("======================");
 *         student.test01();
 *     }
 */